package com.shop.util;

import javax.servlet.jsp.JspWriter;
import java.io.IOException;

public class JsUtils {

    public static void JsAlertBack(JspWriter out, String msg){
        try {
            out.println("<script>alert('"+msg+"');history.back()</script>");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void JsAlertGo(JspWriter out, String msg, String url){
        try {
            out.println("<script>alert('"+msg+"');location.href='"+url+"'</script>");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
